// 配置信息
// #ifdef VUE2
import Vue from 'vue'
// #endif
// #ifdef VUE3
import {
	reactive,
} from 'vue'
// #endif

export default {
	props: {},
	data() {
		return {
			interval: null,
		}
	},
	beforeCreate() {
		// #ifdef VUE2
		this.$ff = Vue.observable({})
		// #endif
		// #ifdef VUE3
		this.$ff = reactive({})
		// #endif
		this.$set(this.$ff, 'id', uni.$ff.util.guid(20))
		this.$set(this.$ff, 'name', this.$options.name)
		this.$set(this.$ff, 'self', this)
		this.$set(this.$ff, "props", new Proxy({}, {
			get: function(target, key) {
				return Reflect.get(this.$props, key);
			}.bind(this),
		}))
		this.$set(this.$ff, "component", {})
		this.$set(this.$ff, "window", {})
		this.$set(this.$ff, "config", {})
		Object.defineProperty(this.$ff, 'pay', {
			get: function() {
				return uni.$ff.pay
			},
			set: function(val) {
				uni.$ff.pay = val
			}
		})
		Object.defineProperty(this.$ff, 'util', {
			get: function() {
				return uni.$ff.util
			},
		})
		Object.defineProperty(this.$ff, 'root', {
			get: function() {
				return uni.$ff.root
			},
		})
		Object.defineProperty(this.$ff, 'safeAreaInsets', {
			get: function() {
				return uni.$ff.safeAreaInsets
			}
		})
		Object.defineProperty(this.$ff.config, 'icons', {
			get: function() {
				return uni.$ff.config.icons
			},
			set: function(val) {
				uni.$ff.config.icons = val
			}
		})
		Object.defineProperty(this.$ff.config, 'colors', {
			get: function() {
				return uni.$ff.config.colors
			},
			set: function(val) {
				uni.$ff.config.colors = val
			}
		})
		Object.defineProperty(this.$ff.config, 'styles', {
			get: function() {
				return uni.$ff.config.styles
			},
			set: function(val) {
				uni.$ff.config.styles = val
			}
		})
		this.$set(this.$ff.config, "props", {})
		this.$ff.window.setTitle = function(value) {
			let parent = this.$parent
			while (parent !== undefined && parent !== null && parent !== parent.$parent && parent.$options.name !==
				'ff-window') {
				parent = parent.$parent
			}
			if (parent !== undefined && parent !== null) {
				parent.setTitle(value)
			}
		}.bind(this)
		this.$ff.window.getTitle = function() {
			let parent = this.$parent
			while (parent !== undefined && parent !== null && parent !== parent.$parent && parent.$options.name !==
				'ff-window') {
				parent = parent.$parent
			}
			if (parent !== undefined && parent !== null) {
				return parent.getTitle(value)
			}
			return null
		}.bind(this)
	},
	created() {},
	mounted() {

	},
	updated() {

	},
	methods: {

	},
	// #ifdef VUE2
	beforeDestroy() {

	}
	// #endif
	// #ifdef VUE3
	beforeUnmount() {

	}
	// #endif
}